<template>
  <div class="outer">
    <div class="box">
      <header class="header fix">
        <a href="javascript:;" class="backImg" @click="back"></a>
        <p class="titleCity"> 选返程:{{$store.state.flight.back}}--{{$store.state.flight.go}}</p>
      </header>
      <div class="title fix">
        <div class="titleDate">{{flightBack.month}}月{{flightBack.day}}日 {{flightBack.Sunday}}</div>
        <div class="fix">
          <div class="title1 fix">
            <p class="titleGoDate">
              {{flightBack.currentList.fromTime}}
            </p>
            <p class="titleLineMiddle"></p>
            <p class="titleBackDate">
              {{flightBack.currentList.toTime}}
            </p>
          </div>
          <div class="title2 fix">
            <p class="titleGoCity">
              {{flightBack.currentList.fromInfo}}
            </p>
            <p class="flightDuration">
              {{flightBack.currentList.costTime}}
            </p>
            <p class="titleBackCity">
              {{flightBack.currentList.toInfo}}
            </p>
          </div>
          <div class="title3 fix">
            <p class="titleGoType">
              {{flightBack.currentList.carrierInfo}}
            </p>
            <p class="titleLineInfo">
              {{flightType}}
            </p>
            <p class="titleBackType" v-if="flightBack.currentList.mealType">
              <i class="iconfont icon-tangshi"></i>
            </p>
          </div>
        </div>
      </div>
    </div>
    <div class="main">
      <scroll  style="overflow: hidden;position: absolute;top: 0;left: 0;right: 0;bottom: 0">
        <ul>
          <li class="item fix" v-for="(arr, key, indexs) in flightBack.currentList.cabinMap">
            <div class="detail-title" v-if="arr.length > 0 && key === 'CUSTOMER_AGREEMENT'">大客户协议价</div>
            <div class="detail-title" v-if="arr.length > 0 && key === 'CARRIER_DIRECT'">航司直销</div>
            <div class="detail-title" v-if="arr.length > 0 && key === 'BUSINESS_OPTIMIZATION'">商务优选</div>
            <div v-for="(item, index) in arr" v-if="arr.length > 0" class="item-flex">
              <div class="l itemSub">
                <div class="fix">
                  <!--<p class="cangwei" v-if="item.grade==='Y'">经济舱&nbsp;{{item.subCabinCode}}<span v-if="!item.subCabinCode">{{item.cabinCode}}</span>
                  </p>
                  <p class="cangwei" v-if="item.grade==='C'">公务舱&nbsp;{{item.subCabinCode}}<span v-if="!item.subCabinCode">{{item.cabinCode}}</span>
                  </p>
                  <p class="cangwei" v-if="item.grade==='F'">头等舱&nbsp;{{item.subCabinCode}}<span v-if="!item.subCabinCode">{{item.cabinCode}}</span>
                  </p>-->
                  <p class="discount1" v-show="item.isDirect">航司直营</p>
                  <p class="money"><span class="moneyIco">￥</span>{{item.salePrice}}</p>
                </div>
                <div>
                  <span class="cangwei" v-if="item.grade==='Y'">经济舱&nbsp;{{item.subCabinCode}}<span v-if="!item.subCabinCode">{{item.cabinCode}}</span>
                  </span>
                  <span class="cangwei" v-if="item.grade==='C'">公务舱&nbsp;{{item.subCabinCode}}<span v-if="!item.subCabinCode">{{item.cabinCode}}</span>
                  </span>
                  <span class="cangwei" v-if="item.grade==='F'">头等舱&nbsp;{{item.subCabinCode}}<span v-if="!item.subCabinCode">{{item.cabinCode}}</span>
                  </span>
                  <span class="discount-riles" v-if="item.discount">{{item.discount}}</span>
                  <span class="quit-ticket-rules"
                        v-if="quitTicketRule.length> 0"
                        v-show="quitTicketRule[index]['minPrice'] === -1"
                        @click="onShowPopupRule(item.cabinCode, item.salePrice, item, index)">退改签规定></span>
                  <span class="quit-ticket-rules"
                        v-if="quitTicketRule.length> 0"
                        v-show="quitTicketRule[index]['minPrice'] === 0"
                        @click="onShowPopupRule(item.cabinCode, item.salePrice, item, index)">{{quitTicketRule[index]['typeMsg']}}></span>
                  <span class="quit-ticket-rules"
                        v-if="quitTicketRule.length> 0"
                        v-show="quitTicketRule[index]['minPrice'] !== 0 && quitTicketRule[index]['minPrice'] !== -1"
                        @click="onShowPopupRule(item.cabinCode, item.salePrice, item, index)">退改￥{{quitTicketRule[index]['minPrice']}}起></span>
                  <span class="r money" v-if="parseInt(item.restSeatNum) < 10">剩{{item.restSeatNum}}张</span>
                </div>
              </div>
              <div class="r r-money">
                <div class="yuding" @click="yuding(item,index)" v-if="item.withinTwoHoursLowestPrice">
                  <div class="yudingText">预订</div>
                  <div class="lowPrice">低价</div>
                </div>
                <div class="yuding" @click="yuding(item,index)" v-else>
                  <div>预订</div>
                </div>
              </div>
            </div>
          </li>
        </ul>
        <!--<ul>-->
          <!--<li class="item fix" v-for="(item,index) in flightBack.currentList.cabinShowList" v-if="item.grade">-->
            <!--<div class="l itemSub">-->
              <!--<div class="fix">-->
                <!--<p class="cangwei" v-if="item.grade==='Y'">经济舱&nbsp;{{item.subCabinCode}}<span v-if="!item.subCabinCode">{{item.cabinCode}}</span>-->
                <!--</p>-->
                <!--<p class="cangwei" v-if="item.grade==='C'">公务舱&nbsp;{{item.subCabinCode}}<span v-if="!item.subCabinCode">{{item.cabinCode}}</span>-->
                <!--</p>-->
                <!--<p class="cangwei" v-if="item.grade==='F'">头等舱&nbsp;{{item.subCabinCode}}<span v-if="!item.subCabinCode">{{item.cabinCode}}</span>-->
                <!--</p>-->
                <!--<p class="discount1" v-show="item.isDirect">航司直营</p>-->
                <!--<p class="money"><span class="moneyIco">￥</span>{{item.salePrice}}</p>-->
              <!--</div>-->
              <!--<div>-->
                <!--<span>{{item.discount}}</span>-->
                <!--<span class="quit-ticket-rules"-->
                      <!--v-if="quitTicketRule.length> 0"-->
                      <!--v-show="quitTicketRule[index]['minPrice'] === -1"-->
                      <!--@click="onShowPopupRule(item.cabinCode, item.salePrice, item, index)">退改签规定></span>-->
                <!--<span class="quit-ticket-rules"-->
                      <!--v-if="quitTicketRule.length> 0"-->
                      <!--v-show="quitTicketRule[index]['minPrice'] === 0"-->
                      <!--@click="onShowPopupRule(item.cabinCode, item.salePrice, item, index)">{{quitTicketRule[index]['typeMsg']}}></span>-->
                <!--<span class="quit-ticket-rules"-->
                      <!--v-if="quitTicketRule.length> 0"-->
                      <!--v-show="quitTicketRule[index]['minPrice'] !== 0 && quitTicketRule[index]['minPrice'] !== -1"-->
                      <!--@click="onShowPopupRule(item.cabinCode, item.salePrice, item, index)">退改￥{{quitTicketRule[index]['minPrice']}}起></span>-->
                <!--<span class="r money" v-if="parseInt(item.restSeatNum) < 10">剩{{item.restSeatNum}}张</span>-->
              <!--</div>-->
            <!--</div>-->
            <!--<div class="r r-money">-->
              <!--<div class="yuding" @click="yuding(item,index)" v-if="item.withinTwoHoursLowestPrice">-->
                <!--<div class="yudingText">预订</div>-->
                <!--<div class="lowPrice">低价</div>-->
              <!--</div>-->
              <!--<div class="yuding" @click="yuding(item,index)" v-else>-->
                <!--<div>预订</div>-->
              <!--</div>-->
            <!--</div>-->
          <!--</li>-->
        <!--</ul>-->
      </scroll>
    </div>
    <!--退票规则弹框-->
    <div v-transfer-dom>
      <Popup v-model="popupQuitRulesVisible" position="bottom" height="100%" style="background-color: #fff;overflow: hidden">
        <flight-quit-rule @bookingTicket="bookingTicket"
                          @closePopupContent="closePopupContent"
                          :isShowBtn = true
                          :navList="navList"
                          :beforeRefundTime="beforeRefundTime"
                          :beforeRefundMoney="beforeRefundMoney"
                          :beforechangeMoney="beforechangeMoney"
                          :typeNum="typeNum"
                          :isTurnTicket="isTurnTicket"
                          :baggage="baggage"
                          :itemTimeOne="itemTimeOne"
                          :itemTimeTwo="itemTimeTwo"
                          :itemTimeThree="itemTimeThree"
                          :salePrice="salePrice"></flight-quit-rule>
        <!--前后以一小时最低价-->
        <alert2 v-if="showLowPrice && flightBack.withinTwoHoursLowestPriceList.length > 0" @alert="showLowPrice = false">
          <div class="alertLowPrice">
            <p>您选择的时间段内有更低的航班:</p>
            <ul>
              <li v-for="(item ,index) in flightBack.withinTwoHoursLowestPriceList" class="lowPriceItem"
                  @click="checkPriceAjaxLow(item)">
                <div>
                  <p class="lowSub"><span>起</span><span>{{item.departureTime}}</span><span>{{item.fromAirportName}}</span>
                  </p>
                  <p class="lowSub"><span>降</span><span>{{item.arrivalTime}}</span><span>{{item.toAirportName}}</span></p>
                  <p class="lowSub"><span>{{item.carrierName}}</span><span>{{item.aircraft.code}}</span><span
                    v-if="item.aircraft.type == 1">小机型</span><span v-if="item.aircraft.type == 2">中机型</span><span
                    v-if="item.aircraft.type == 3">大机型</span></p>
                </div>
                <div class="lowMoney">
                  ¥{{item.salePrice}}
                </div>
              </li>
            </ul>
            <p @click="checkPriceAjaxLow(flightBack.currentCabin)">继续选择原航班</p>
          </div>
        </alert2>
      </Popup>
    </div>
    <!--价格变动弹框 -->
    <alert1 v-show="alertShowPriceChange" class="ll" :confirmInfo="message" @confirmBtnL="cancelA"
            @confirmBtnR="successA">
    </alert1>
    <confirmOne :confirmOneInfo="confirmOneInfo" @confirmOneBtn="confirmOneBtn" v-show="confirmOneShow"></confirmOne>
    <confirmOne :confirmOneInfo="message" @confirmOneBtn="cancelA" v-show="alertShowTicketsChange"></confirmOne>
    <returnalert v-show='returenDate' class="return-alert">
      <div class="alert-con">
        <div>去程时间大于返程时间</div>
        <p>去程时间:{{go_date}}</p>
        <p>返程时间:{{to_date}}</p>
      </div>
      <div class="return-but" @click="close_date">从新添加</div>
    </returnalert>
    <date @dateClick="dateClick" @dateBack="dateBack" v-show="dateShow" :max="max" :openTime="to_date"></date>
    <!--前后以一小时最低价-->
    <alert2 v-if="showLowPrice && flightBack.withinTwoHoursLowestPriceList.length > 0" @alert="showLowPrice = false">
      <div class="alertLowPrice">
        <p>您选择的时间段内有更低的航班:</p>
        <ul>
          <li v-for="(item ,index) in flightBack.withinTwoHoursLowestPriceList" class="lowPriceItem"
              @click="checkPriceAjaxLow(item)">
            <div>
              <p class="lowSub"><span>起</span><span>{{item.departureTime}}</span><span>{{item.fromAirportName}}</span>
              </p>
              <p class="lowSub"><span>降</span><span>{{item.arrivalTime}}</span><span>{{item.toAirportName}}</span></p>
              <p class="lowSub"><span>{{item.carrierName}}</span><span>{{item.aircraft.code}}</span><span
                v-if="item.aircraft.type == 1">小机型</span><span v-if="item.aircraft.type == 2">中机型</span><span
                v-if="item.aircraft.type == 3">大机型</span></p>
            </div>
            <div class="lowMoney">
              ¥{{item.salePrice}}
            </div>
          </li>
        </ul>
        <p @click="checkPriceAjaxLow(flightBack.currentCabin)">继续选择原航班</p>
      </div>
    </alert2>
  </div>
</template>


<script>
  import alert1 from "components/confirm.vue"
  import alert2 from "components/alert.vue"
  import confirmOne from "components/confirmOne.vue"
  import {Indicator, Toast} from "mint-ui"
  import returnalert from 'components/alert.vue';
  import date from 'components/date.vue';
  import Scroll from "../../../common/scroll/scroll.vue"
  import { Popup, TransferDomDirective as TransferDom} from 'vux'
  import flightQuitRule from '../../../components/flight/flight-quit-rule.vue'
  export default{
    data(){
      return {
        item: {},
        indexs: 0,
        flightPriceNum: 0,
        itemTimeOne: '',
        itemTimeTwo: '',
        itemTimeThree: '',
        baggage: 20,
        isTurnTicket: '',
        typeNum: 1,
        beforeRefundTime: [],
        beforeRefundMoney: [],
        navList: ['退改详情', '行李说明'],
        lowPriceRule: [], // 请求接口拿到数组
        quitTicketRule: [], //数据筛选后拿到的对于数据
        beforechangeMoney: [],
        popupQuitRulesVisible: false,
        showLowPrice: false,
        goback: false,
        alertShowPriceChange: false,
        alertShowTicketsChange: false,
        flightPriceDto: '',
        message: "价格变动",
        dateTitle: '10月10日周一',
        titleGoDate: "06:40",
        titleGoCity: '首都机场T2',
        titleGoType: '东方航空HU7604',
        titleBackDate: "06:40",
        titleBackCity: '首都机场T2',
        titleLineInfo: '中型机',
        titleBackType: '经济舱',
        confirmOneInfo: '',
        confirmOneShow: false,
        returenDate: false,
        dateShow: false,
        obervious: true,
        isDirect: false,
      }
    },
    directives: {
      TransferDom
    },
    components: { alert1: alert1, confirmOne, returnalert, date, alert2: alert2,Scroll,Popup, flightQuitRule},
    methods: {
      closePopupContent() {
        this.popupQuitRulesVisible = false;
      },
      //调用接口拿到舱位退改详情信息
      onShowPopupRule(itemCabinCode, salePrice, item, index) {
        let that = this;
        this.salePrice = salePrice;
        that.item = item;
        that.indexs = index;
        let rulePriceDetailObj = {
          cabinCode: itemCabinCode,
          carrierCode: that.$route.query.carrierCode,
          fromAirport: that.$route.query.fromAirport,
          toAirport: that.$route.query.toAirport
        };
        that.$flight.flightRefundChangeDetail(rulePriceDetailObj, function (res) {
          that.popupQuitRulesVisible = true;
          that.typeNum = res.type;
          if(that.typeNum == 1) {
            that.beforechangeMoney = res.changeAmountList;
            that.beforeRefundTime = res.headers;
            that.beforeRefundMoney = res.refundAmountList;
            that.isTurnTicket = res.endorseRule;
          } else if(that.typeNum == 2) {
            that.beforechangeMoney = res.changeAmountList.splice(0, 1);
            that.beforeRefundTime = res.headers.splice(0, 1);
            that.beforeRefundMoney = res.refundAmountList.splice(0, 1);
            that.isTurnTicket = res.endorseRule;
          } else if(that.typeNum == 3) {
            that.itemTimeOne = res.headers[0];
            that.itemTimeTwo = res.headers[1];
            that.itemTimeThree = res.headers[2];
          }
          that.baggage  = parseInt(res.baggage.replace(/[^0-9]/ig,"") );
        }, function (err) {
          that.$router.push({
            path: 'error'
          })
        })
      },
      // 筛选后端返回的对于字母数组数据
      _getPriceRules() {
        var that = this;
        let priceRuleObj = that.$store.state.flightBack.currentList.cabinShowList;
        let getLowPriceRule = that.lowPriceRule;
        priceRuleObj.forEach((arr, index) => {
          getLowPriceRule.forEach((newArr, newIndex) => {
            if(arr.cabinCode === newArr.cabinCode) {
              that.quitTicketRule.push(getLowPriceRule[newIndex])
            }
          })
          return;
        })
      },
      confirmOneBtn(){
        this.confirmOneShow = false;
      },
      back(){
        this.$router.go(-1);
      },
      cancelA(){
        this.popupVisible3 = false;
        this.$router.go(-1);
      },//      价格变动弹窗  取消按钮
      successA(){
        var currentCabin = this.$store.state.flightBack.currentCabin;
        currentCabin.facePrice = currentCabin.salePrice = this.checkPrice;
        this.alertShowPriceChange = false;
        this.gobackPage();
      },//      价格变动弹窗  确认按钮
      checkPriceAjaxLow(cabinShowList){   //拿的数据字断名不一样,只能在开一个请求

        this.showLowPrice = false;
        this.$store.state.flightBack.currentCabin = cabinShowList;
        var that = this;
        var searchDto = {
          fromDate: cabinShowList.departureDate,
          flightNo: cabinShowList.flightNo,

          agreementPolicyId: cabinShowList.agreementPolicyId,
          productType: cabinShowList.productType,

          cabinCode: cabinShowList.cabinCode,
          fromCityCode: cabinShowList.fromCity,
          toCityCode: cabinShowList.toCity,
          routeRuleItemId:cabinShowList.routeRuleItemId,
          withinTwoHoursLowestPrice: cabinShowList.withinTwoHoursLowestPrice == undefined || cabinShowList.withinTwoHoursLowestPrice == true && true
        };
        this.$store.state.flightBack.searchDto = searchDto; //用于创单使用

        that.$vux.loading.show({
          text: '加载中...'
        })
        that.$flight.checkPrice({
          carrierCode: cabinShowList.carrierCode,
          flightNo: cabinShowList.flightNo,

          departureDate: cabinShowList.departureDate,
          departureTime: cabinShowList.departureTime,


          agreementPolicyId: cabinShowList.agreementPolicyId,
          productType: cabinShowList.productType,

          arrivalDate: cabinShowList.arrivalDate,//到达时间 yyyy-MM-dd
          arrivalTime: cabinShowList.arrivalTime,//到达时间 HH:mm

          fromAirport: cabinShowList.fromAirport,
          toAirport: cabinShowList.toAirport,

          fromCity: cabinShowList.fromCity,
          toCity: cabinShowList.toCity,

          routeRuleItemId: cabinShowList.routeRuleItemId,
          productType: cabinShowList.productType,
          cabinCode: cabinShowList.cabinCode,

          subCabinCode: cabinShowList.subCabinCode,
          cabinClass: cabinShowList.cabinClass,
          originalPrice: cabinShowList.originalPrice
        }, function (data) {
          that.$vux.loading.hide();
          that.$store.state.flightBack.checkData = data.data;
          switch (data.code) {
            case '-1'://一切正常
              searchDto.otherCheckPriceRouteRuleItemId = data.data.routeRuleItemId;
              that.gobackPage();
              break;
            case '3'://价格变化
              that.alertShowPriceChange = true;
              that.message = data.message;
              break;
            case '4':
              that.$vux.alert.show(data.message);
              break;
            case '105':
              that.alertShowTicketsChange = true;
              that.message = data.message;
              break;
          }
        }, function () {
          that.$vux.loading.hide();
          that.$vux.toast.show({
            type: 'text',
            content: '验价失败'
          });
        });
      },
      bookingTicket() {
        let that = this;
        this.$store.state.flightBack.cabinIndex = that.indexs;
        this.$store.state.flightBack.currentCabin = that.item;
        if (that.item.withinTwoHoursLowestPrice) {//如果当前为最低航班,直接验价
          that.checkPriceAjaxLow(that.item);
        } else {//否则,弹出低价框
          that.$store.state.flightBack.withinTwoHoursLowestPriceList = that.item.withinTwoHoursLowestPriceList;
          that.showLowPrice = true;
        }
      },
      yuding(item, index){
        this.$store.state.flightBack.cabinIndex = index;
        this.$store.state.flightBack.currentCabin = item;

        if (item.withinTwoHoursLowestPrice) {//如果当前为最低航班,直接验价
          this.checkPriceAjaxLow(item);
        } else {//否则,弹出低价框

          this.$store.state.flightBack.withinTwoHoursLowestPriceList = item.withinTwoHoursLowestPriceList;
          this.showLowPrice = true;
        }
      },
      gobackPage(){
        this.$store.state.goillegalReasonList = [];
        this.$store.state.skipIllegalCheck = false;
        var that = this;

        var flight = this.$store.state.flight;
        var flightTo = this.flightTo;
        var flightBack = this.flightBack;
        console.log(flightTo.searchDto)
        that.$flight.flightPriceChange({
          fromCityCode: flight.flightForm.fromCity,//出发城市字段
          toCityCode: flight.flightForm.toCity,//到达城市字段
          fromDate: flight.fromDate,//出发时间
          otherDate: flight.returnTimes,//返程时间
          productType: flightTo.searchDto.productType,
          agreementPolicyId: flightTo.searchDto.agreementPolicyId,
          flightNo: flightTo.searchDto.flightNo,
          routeRuleItemId: flightTo.searchDto.routeRuleItemId,
          cabinCode: flightTo.searchDto.cabinCode,//舱位code
          withinTwoHoursLowestPrice: flightTo.searchDto.withinTwoHoursLowestPrice,

          agreementPolicyId: flightTo.searchDto.agreementPolicyId,
          productType: flightTo.searchDto.productType,
          otherAgreementPolicyId: flightBack.searchDto.agreementPolicyId,
          otherProductType: flightBack.searchDto.productType,

          otherFlightNo: flightBack.searchDto.flightNo,//返程机号
          otherRouteRuleItemId: flightBack.searchDto.routeRuleItemId,
          otherCabinCode: flightBack.searchDto.cabinCode,
          otherWithinTwoHoursLowestPrice: flightBack.searchDto.withinTwoHoursLowestPrice,
          checkPriceRouteRuleItemId: flightTo.searchDto.checkPriceRouteRuleItemId,
          otherCheckPriceRouteRuleItemId: flightBack.searchDto.otherCheckPriceRouteRuleItemId
        }, (res) => {
          switch (res.code) {
            case "7":
              that.confirmOneInfo = res.message;
              that.confirmOneShow = true;
              that.$vux.loading.hide();
              return;
          }
          console.log(res)
          that.$store.state.flightTo.detailDto = res.detailDto;//填单页,去程所需要数据
          that.$store.state.flightBack.detailDto = res.returnDetailDto;//填单页,去程所需要数据
          that.$store.state.flightBack.serverCharge = res.serverCharge;//往返程服务费都一样  放在返程里
          that.$store.state.flightBack.searchDto = res.searchDto;//往返程searchDto 放在返程里



          that.$store.state.insurancedata.flight.Insurance = res.hasInsurance;
          that.$store.commit('setCredentialInfo', res.credentialTypes);
          /*设置成火车票的证件类型*/
          that.$store.state.contact = res.contacts;

          that.$store.state.expenseTravelType.travelTypes = res.travelTypes;//出差申请
          that.$store.state.expenseTravelType.expenseTree = res.expenseTravel;//费用归属

          that.$store.state.flight.peopleMsg.costUnitCode = that.$store.state.expenseTravelType.expenseTree[0].code;
          that.$store.state.flight.peopleMsg.orgId = that.$store.state.expenseTravelType.expenseTree[0].orgId;
          that.$store.state.flight.peopleMsg.corporationId = that.$store.state.expenseTravelType.expenseTree[0].corpId;

          var recentPassenger = [];
          var userInfo = that.$store.state.userInfo;
          var flagCheck = false;
          for (let recentItem of res.recentPassengerList) {
            let ob = {};
            ob.checked = recentItem.userId == userInfo.userId || recentItem.appIsChecked;
            ob.userId = recentItem.userId;
            ob.costUnitCode = '';
            ob.orgId = '';
            ob.corporationId = '';
            ob.amount = '';
            ob.mobile = recentItem.mobile;
            ob.email = recentItem.email;
            ob.travelCode = '';
            ob.empLevelCode = recentItem.empLevelCode;
            ob.isPassEmpLevel = recentItem.isPassEmpLevel;
            ob.name = recentItem.name;
            ob.sex = recentItem.genderValue;
            ob.sexType = recentItem.gender;
            ob.credentialName = recentItem.credentialTypeValue;
            ob.credentialType = recentItem.credentialType;
            ob.passengerType = recentItem.passengerType;
            ob.credentialNo = recentItem.credentialNo;
            ob.travellerType = recentItem.travellerType;
            ob.checked = recentItem.appIsChecked;
            ob.birthday = recentItem.birthday;
            recentPassenger.unshift(ob);
            if(ob.checked){
              flagCheck = true;
            }
          }
          if(flagCheck == false && userInfo && userInfo.userId){
            if(userInfo.cardType && userInfo.cardType.length > 0) {
              recentPassenger.unshift({
                checked:true,
                userId: userInfo.userId,
                costUnitCode: '',
                orgId: '',
                corporationId: '',
                amount: '',
                mobile: userInfo.mobile,
                email: userInfo.email,
                travelCode: '',
                empLevelCode: userInfo.rank,
                isPassEmpLevel: 1 == userInfo.status,
                name: userInfo.name,
                sex:  userInfo.sex == 0 ? '男' : '女',
                sexType: userInfo.sex == 0 ? 'M' : 'F',
                credentialName: that.cardName(userInfo.cardType[0].idType),
                credentialType: userInfo.cardType[0].idType,
                passengerType: 'ADU',
                credentialNo: userInfo.cardType[0].idNumber,
                travellerType: 3,
                birthday: userInfo.birthday,
              });
            }
          }
          var list = {
            'list': recentPassenger,
            'type': 'pre'
          };

          that.$store.commit('setRecentPassengerList', list);
          that.$store.state.jobTitleRanks = res.empLevelList;//接受后台给的职级选项
          that.$store.state.reasonForms = res.dictCodes;
          that.$store.state.reasonData = res.dictCodes;//违规页需要的理由选项
          that.$router.push({
            name: 'returnbooking'
          });
          that.$vux.loading.hide();
        }, (err) => {
          that.$vux.loading.hide();
        })
      },//飞机往返的填单页
      //把证件信息id转换成对应的文字
      cardName(type) {
        var cardIdName = null;
        $.each(this.$store.state.credentialInfo, function (index, item) {
          if (item.itemCode == type) {
            cardIdName = item.itemTxt;
            return false;
          }
        });
        return cardIdName;
      },
      close_date(){
        this.returenDate = false
        this.dateShow = true;
      },//关闭时间弹窗
      dateBack(){
        this.dateShow = false;
      },//关闭时间插件
      dateClick(msg){
        this.dateShow = false;
        this.$store.state.flightBack.returnTimes = msg;
      } //时间的选择
    },
    mounted(){
      let that = this;
      that.$store.state.flightBack.backCabinIndex = 0;
      Indicator.close();
      let lowPriceObj = {
        carrierCode: this.$route.query.carrierCode,
        fromAirport: this.$route.query.fromAirport,
        toAirport: this.$route.query.toAirport
      }
      that.$flight.flighOptimalRule(lowPriceObj, function (res) {
        that.lowPriceRule = res
        that._getPriceRules();
      }, function (err) {
        that.$router.push({
          path: 'error'
        })
      })
    },
    computed: {
      flightType(){ //      机型转换
        var flightType = '';
        if (this.flightBack.currentList.aircraftDto) {
          if (this.flightBack.currentList.aircraftDto.type) {
            var type = this.flightBack.currentList.aircraftDto.type;
            if (type == 3) {
              flightType = '大型机';
            } else if (type == 2) {
              flightType = '中型机';
            } else if (type == 1) {
              flightType = '小型机'
            }
          }
        }
        return flightType
      },
      index(){
        return this.$store.state.flightBack.index
      },
      flightTo(){
        return this.$store.state.flightTo
      },
      flightBack(){
        return this.$store.state.flightBack
      },
      go_date(){
        return this.$store.state.flight.fromDate
      },
      to_date(){
        return this.$store.state.flight.returnTimes
      },
    },
    watch: {}
  }


</script>
<style rel="stylesheet/scss" scoped>
  .item {
    background-color: #fff;
  }
  .item>.item-flex {
    display: flex;
    padding: .65rem .5rem;
    line-height: .85rem;
    border-bottom: 1px solid #eee;
  }
  .detail-title {
    padding: .5rem;
    font-size: .65rem;
    color: #666;
    border-bottom: 1px solid #eee;
  }

  .itemSub {
    flex: 0 0 70%;
  }
  .itemSub>div:nth-child(2) {
    color: #999;
  }
  .r-money {
    flex:  0 0 30%;
  }

  .item p {
    float: left;
    line-height: 1.3rem;
  }

  .cangwei {
    width: 40%;
    font-size: .6rem;
    color: #999;
  }

  .discount {
    width: 4.5rem;
    height: 1.3rem;
    line-height: 1.3rem;
  }

  p.discount1 {
    width: 2.5rem;
    height: 1rem;
    font-size: .55rem !important;
    background-color: #46a1bb;
    margin-left: .15rem;
    text-align: center;
    color: #fff;
    padding: 0 .125rem 0 .125rem;
    border-radius: .125rem;
    opacity: 0.5;
    line-height: 1rem;
  }

  .isDirect {
    width: 4.5rem;
    height: 1.3rem;
  }

  p.money {
    float: left;
    font-size: .8rem;
    width: 3.75rem;
    color: #f60;
    text-align: left;
    height: 1.3rem;
    line-height: 1.3rem;
  }

  .moneyIco {
    font-size: .65rem; /*px*/
  }
  .money {
    color: #f60!important;
  }

  .item .yuding {
    float: right;
    width: 2.2rem;
    text-align: center;
    color: #fff;
    height: 2.25rem;
    line-height: 2.25rem;
    font-size: .75rem;
    background-color: #46a1bb;
    border-radius: .2rem;
    box-sizing: border-box;
  }

  .item .yudingText {
    line-height: 1.25rem;
    font-size: .75rem;
    width: 2.2rem;
    border-radius: .2rem .2rem 0 0;
    border: 1px solid #46a1bb;
    background-color: #46a1bb;
  }

  .item .lowPrice {
    width: 2.2rem;
    line-height: 1rem;
    text-align: center;
    background-color: #fff;
    color: #46a1bb;
    border: 1px solid #46a1bb;
    border-radius: 0 0 .2rem .2rem;
    font-size: .55rem;
  }

</style>
<style scoped>

  /*header*/
  .outer {
    width: 100%;
    position: relative;
    background-color: #e6e6e6;
    font-size: .6rem; /*px*/
    height: 100%;
    overflow: hidden;
  }

  .box {
    top: 0;
    left: 0;
    right: 0;
  }

  .header {
    background: #46a1bb;
    height: 2.2rem;
    background-size: cover;
    /*font-size: 32px;!*px*!*/
    color: #fff;
    padding: 0 .75rem;
  }

  .backImg {
    float: left;
    width: 1.7rem;
    height: 2.2rem;
    line-height: 2.2rem;
    text-align: left;
    background: url('../../../assets/images/back.png') no-repeat left center;
    background-size: .6rem 1.1rem;
  }

  .main {
    position: relative;
    height: calc(100% - 8.7rem);
    background-color: #fff;
  }
  .titleCity {
    float: left;
    height: 2.2rem;
    width: 73.33%;
    text-align: center;
    line-height: 2.2rem;
    font-size: .9rem; /*px*/
  }
  .title {
    text-align: center;
    background-color: #fff;
    width: 100%;
    height: 6.5rem;
    margin: 0 .25rem .25rem 0;
  }
  .titleDate {
    font-size: .75rem; /*px*/
    text-align: left;
    padding: .65rem .5rem;
  }
  .title1 {
    display: flex;
    width: 100%;
    line-height: 1.5rem;
    font-size: 1.15rem; /*px*/
  }
  .title1 p,
  title2 p {
    flex: 1;
  }

  .title2 {
    display: flex;
    width: 100%;
    line-height: 1.25rem;
  }

  .title3 {
    line-height: 1.25rem;
  }

  .titleLineMiddle {
    height: 1.5rem;
    background: url("../../../assets/images/goBackLine.png") no-repeat center;
    background-size: 5.65rem .25rem;
  }

  .titleGoCity {
    flex: 1;
  }

  .flightDuration {
    flex: 1;
    text-align: center;
  }

  .titleBackCity {
    flex: 1;
  }

  .titleGoType {
    width: 33.33%;
    float: left;
    text-align: center;
  }

  .titleLineInfo {
    float: left;
    width: 3.75rem;
  }

  .titleBackType {
    width: 7rem;
    float: right;
    margin-right: .25rem;
  }


</style>

<style rel="stylesheet/scss" lang="scss">
  .toastYuError {
    width: 12rem;
    text-align: center;
    .mint-toast-text {
      font-size: .7rem !important; /*px*/
    }
  }

  .mint-indicator-mask {
    z-index: 999999998;
  }

  .mint-indicator-wrapper {
    z-index: 999999999;
  }
</style>

<!--前后一小时最低价弹窗-->
<style scoped>
  .alertLowPrice {
    width: 15rem;
    box-sizing: border-box;
  }

  .alertLowPrice > ul {
    max-height: 15rem;
    overflow: auto;
  }

  .alertLowPrice > p:first-of-type {
    background-color: #46a1bb;
    color: #fff;
    font-size: .7rem;
    padding: .5rem 0;
  }

  .alertLowPrice > p:last-of-type {
    background-color: #46a1bb;
    color: #fff;
    font-size: .7rem;
    padding: .5rem 0;
  }

  .lowPriceItem {
    display: flex;
    justify-content: space-between;
    padding: .45rem 1.2rem .45rem 1.75rem;
    font-size: .65rem;
    line-height: 1rem;
    border-bottom: 1px solid #ddd;
  }

  .lowPriceItem:last-of-type {
    border: none;
  }

  .lowSub {
    text-align: left;
  }

  .lowSub > span {
    margin-right: .375rem;
  }

  .lowMoney {
    line-height: 3rem;
    font-size: 1.25rem;
    color: #f60;
  }
</style>
